package com.examplemartin.jpademo.pojo.po.repository.sell;

import com.examplemartin.jpademo.annotation.EntityCheck;
import com.examplemartin.jpademo.pojo.admin.BaseEntity;
import com.examplemartin.jpademo.pojo.po.UserPO;
import com.examplemartin.jpademo.pojo.po.sell.SellPO;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 销售出库实体
 */

@Data
@EqualsAndHashCode(callSuper = true)
@Entity(name = "t_sellout")
public class SellOutPO extends BaseEntity implements Serializable,Cloneable {

  // 对应仓管员 one
  @ManyToOne
  private UserPO userPO;

  // 销售出库单 one
  @ManyToOne
  private SellPO sellPO;

  // 销售出库单明细 list
//  @JsonIgnore
  @OneToMany(mappedBy = "sellOutPO")
  private List<SellOutDetailPO> sellOutDetailPOList;

  // 补货单 List
//  @JsonIgnore
//  @OneToMany(mappedBy = "sellOutPO")
//  private List<ReplentPO> replentPOList;


  // 订单好
  @EntityCheck(required = true, errRequired = "必须输入库单号")
  private String name;

  // 出货日期
  private Date need;

  // 状态
  private Integer status;

  // 注释
  private String comment;

  @Override
  public Object clone() throws CloneNotSupportedException {
    return super.clone();
  }

  @Override
  public String toString() {
    return "SellOutPO{" +
            "userPO=" + userPO +
            ", sellPO=" + sellPO +
            ", name='" + name + '\'' +
            ", need=" + need +
            ", status=" + status +
            ", comment='" + comment + '\'' +
            '}';
  }
}
